function img_rand_adcode() {
img_ad_html = '';
if ( jQuery(window).width() <= 767 ) {
var adsize = '[[300, 50], [320, 50]]';
img_ad_html = '
';
} else {
var adsize = '[[300, 100], [300, 50], [468, 60], [320, 50], [550, 100]]';
img_ad_html = '
';
}
io_css = '';
if( jQuery(window).width() <= 330 ) {
io_css = 'margin:0 -20px';
}
//ad300x250
if ( jQuery(window).width() <= 767 ) {
img_ad_html += '
var googletag = googletag || {};googletag.cmd = googletag.cmd || [];googletag.cmd.push(function() {slot = googletag.defineSlot("/1050432/www.financialexpress.com/FE_Mobile_IMAGE_OVERLAY", '+ adsize +', "div-gpt-ad-1567079617034-0").addService(googletag.pubads());googletag.pubads().enableSingleRequest();googletag.pubads().collapseEmptyDivs(); googletag.enableServices();googletag.display("div-gpt-ad-1567079617034-0");googletag.pubads().refresh([slot]);});';
} else {
img_ad_html += '
var googletag = googletag || {};googletag.cmd = googletag.cmd || [];googletag.cmd.push(function() {slot = googletag.defineSlot("/1050432/www.financialexpress.com/FE_Desktop_IMAGE_OVERLAY", '+ adsize +', "div-gpt-ad-1567146677530-0").addService(googletag.pubads());googletag.pubads().enableSingleRequest();googletag.pubads().collapseEmptyDivs(); googletag.enableServices();googletag.display("div-gpt-ad-1567146677530-0");googletag.pubads().refresh([slot]);}); ';
}
return img_ad_html;
}
function img_generate_ad( afterad ) {
try{
var cmnter = 0;
jQuery( 'div.article-image, .imgwrapper, .main-story-content' ).each( function() {
if ( 1 == cmnter ) {
return false;
}
jQuery( this ).find( 'img' ).each( function() {
if ( jQuery( this ).next( '.imghalder' ).html() == undefined ) {
getadcode = img_rand_adcode();
jQuery( getadcode ).insertAfter( this );
jQuery( '#inhouseimg' ).css( "width", jQuery( this ).width() );
if( jQuery( '.io-code-box' ).html() != undefined && ! jQuery( '.io-code-box' ).attr( 'style' ).match( 'none' ) ) {
var tu = setTimeout( function() {
var imgclose = '1px';
if( jQuery( document ).width() <= 330 ) {
imgclose = '0';
}
jQuery( '.io-code-box > div' ).prepend( '